package com.example.androidautoproject.service

import android.util.Log
import cn.vove7.andro_accessibility_api.AccessibilityApi
import cn.vove7.auto.core.AppScope
import cn.vove7.auto.core.api.withText

class BaseAccessibilityService: AccessibilityApi(){
    //启用 页面更新 回调
    override val enableListenPageUpdate: Boolean = true

    override fun onCreate() {
        //同时设置
        baseService = this
        AccessibilityApi.gestureService = this
        super.onCreate()
    }
    override fun onDestroy() {
        //同时设置
        baseService = null
        AccessibilityApi.gestureService = null
        super.onDestroy()
    }
    //页面更新回调
    override fun onPageUpdate(currentScope: AppScope) {
        Log.d("TAG", "onPageUpdate: $currentScope")
        Thread.sleep(1000)
        withText("任务").click()
    }
}